Change in openvpn[master]: options: Review use of positive_atoi vs atoi_constrained
A message that is not in the archive (sent off-list or not yet received): gerrit.1755877911000.Id440917f433aab1a7db608ba04fa95ba47c2ddde@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
to review the following change.
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
options: Review use of positive_atoi vs atoi_constrained
Replace where it is useful.
---
M src/openvpn/options.c
1 file changed, 21 insertions(+), 31 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/53/1153/1
src/openvpn/options.c +21 -31
@@ -7007,21 +7007,15 @@else if (streq (p[0 ],"tun-mtu-max" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); -int max_mtu =positive_atoi (p[1 ], msglevel); -if (max_mtu <68 || max_mtu >65536 ) - { -msg (msglevel,"--tun-mtu-max value '%s' is invalid" , p[1 ]); - } -else - { - options->ce.tun_mtu_max = max_mtu; - } +atoi_constrained (p[1 ], &options->ce.tun_mtu_max, p[0 ],TUN_MTU_MAX_MIN ,65536 , msglevel); }else if (streq (p[0 ],"tun-mtu-extra" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.tun_mtu_extra =positive_atoi (p[1 ], msglevel); - options->ce.tun_mtu_extra_defined = true; +if (atoi_constrained (p[1 ], &options->ce.tun_mtu_extra, p[0 ],0 ,65536 , msglevel)) + { + options->ce.tun_mtu_extra_defined = true; + } }else if (streq (p[0 ],"max-packet-size" ) && p[1 ] && !p[2 ]) {
@@ -7053,11 +7047,8 @@else if (streq (p[0 ],"fragment" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.fragment =positive_atoi (p[1 ], msglevel); - -if (options->ce.fragment <68 ) +if (!atoi_constrained (p[1 ], &options->ce.fragment, p[0 ],68 ,0 , msglevel)) { -msg (msglevel,"--fragment needs to be at least 68" ); goto err; }
@@ -7723,12 +7714,14 @@VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );if (p[1 ]) { -int mssfix =positive_atoi (p[1 ], msglevel); -/* can be 0, but otherwise it needs to be high enough so we can -* substract room for headers. */ -if (mssfix !=0 && (mssfix <TLS_CHANNEL_MTU_MIN || mssfix >UINT16_MAX )) +int mssfix; +if (!atoi_constrained (p[1 ], &mssfix, p[0 ],0 ,UINT16_MAX , msglevel)) { -msg (msglevel,"--mssfix value '%s' is invalid" , p[1 ]); + goto err; + } +if (mssfix !=0 && mssfix <TLS_CHANNEL_MTU_MIN ) + { +msg (msglevel,"mssfix needs to be >= %d, not %d" ,TLS_CHANNEL_MTU_MIN , mssfix); goto err; }
@@ -7981,7 +7974,7 @@else if (streq (p[0 ],"max-routes-per-client" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_INHERIT ); - options->max_routes_per_client =max_int (positive_atoi (p[1 ], msglevel),1 ); +atoi_constrained (p[1 ], &options->max_routes_per_client, p[0 ],1 ,0 , msglevel); }else if (streq (p[0 ],"client-cert-not-required" ) && !p[1 ]) {
@@ -9795,8 +9788,6 @@ }else if (streq (p[0 ],"keying-material-exporter" ) && p[1 ] && p[2 ]) { -int ekm_length =positive_atoi (p[2 ], msglevel); -VERIFY_PERMISSION (OPT_P_GENERAL );if (strncmp (p[1 ],"EXPORTER" ,8 ))
@@ -9810,14 +9801,14 @@msg (msglevel,"Keying material exporter label must not be '" EXPORT_KEY_DATA_LABEL "'." ); } -if (ekm_length <16 || ekm_length >4095 ) + +if (!atoi_constrained (p[2 ], &options->keying_material_exporter_length, + p[0 ],16 ,4095 , msglevel)) { -msg (msglevel,"Invalid keying material exporter length" ); goto err; } options->keying_material_exporter_label = p[1 ]; - options->keying_material_exporter_length = ekm_length; }else if (streq (p[0 ],"allow-recursive-routing" ) && !p[1 ]) {
@@ -9852,15 +9843,14 @@ }else if (streq (p[0 ],"vlan-pvid" ) && p[1 ] && !p[2 ]) { +int vlan_pvid;VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INSTANCE ); - options->vlan_pvid =positive_atoi (p[1 ], msglevel); -if (options->vlan_pvid <OPENVPN_8021Q_MIN_VID - || options->vlan_pvid >OPENVPN_8021Q_MAX_VID ) +if (!atoi_constrained (p[1 ], &vlan_pvid, p[0 ], +OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID , msglevel)) { -msg (msglevel,"the parameter of --vlan-pvid parameters must be >= %u and <= %u" , -OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID ); goto err; } + options->vlan_pvid = (uint16_t )vlan_pvid; }else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
to look at the new patch set (#3).
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
options: Review use of positive_atoi vs atoi_constrained
Replace where it is useful.
---
M src/openvpn/options.c
1 file changed, 21 insertions(+), 31 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/53/1153/3
src/openvpn/options.c +21 -31
@@ -7011,21 +7011,15 @@else if (streq (p[0 ],"tun-mtu-max" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); -int max_mtu =positive_atoi (p[1 ], msglevel); -if (max_mtu <68 || max_mtu >65536 ) - { -msg (msglevel,"--tun-mtu-max value '%s' is invalid" , p[1 ]); - } -else - { - options->ce.tun_mtu_max = max_mtu; - } +atoi_constrained (p[1 ], &options->ce.tun_mtu_max, p[0 ],TUN_MTU_MAX_MIN ,65536 , msglevel); }else if (streq (p[0 ],"tun-mtu-extra" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.tun_mtu_extra =positive_atoi (p[1 ], msglevel); - options->ce.tun_mtu_extra_defined = true; +if (atoi_constrained (p[1 ], &options->ce.tun_mtu_extra, p[0 ],0 ,65536 , msglevel)) + { + options->ce.tun_mtu_extra_defined = true; + } }else if (streq (p[0 ],"max-packet-size" ) && p[1 ] && !p[2 ]) {
@@ -7057,11 +7051,8 @@else if (streq (p[0 ],"fragment" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.fragment =positive_atoi (p[1 ], msglevel); - -if (options->ce.fragment <68 ) +if (!atoi_constrained (p[1 ], &options->ce.fragment, p[0 ],68 ,INT_MAX , msglevel)) { -msg (msglevel,"--fragment needs to be at least 68" ); goto err; }
@@ -7736,12 +7727,14 @@VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );if (p[1 ]) { -int mssfix =positive_atoi (p[1 ], msglevel); -/* can be 0, but otherwise it needs to be high enough so we can -* substract room for headers. */ -if (mssfix !=0 && (mssfix <TLS_CHANNEL_MTU_MIN || mssfix >UINT16_MAX )) +int mssfix; +if (!atoi_constrained (p[1 ], &mssfix, p[0 ],0 ,UINT16_MAX , msglevel)) { -msg (msglevel,"--mssfix value '%s' is invalid" , p[1 ]); + goto err; + } +if (mssfix !=0 && mssfix <TLS_CHANNEL_MTU_MIN ) + { +msg (msglevel,"mssfix needs to be >= %d, not %d" ,TLS_CHANNEL_MTU_MIN , mssfix); goto err; }
@@ -7994,7 +7987,7 @@else if (streq (p[0 ],"max-routes-per-client" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_INHERIT ); - options->max_routes_per_client =max_int (positive_atoi (p[1 ], msglevel),1 ); +atoi_constrained (p[1 ], &options->max_routes_per_client, p[0 ],1 ,INT_MAX , msglevel); }else if (streq (p[0 ],"client-cert-not-required" ) && !p[1 ]) {
@@ -9808,8 +9801,6 @@ }else if (streq (p[0 ],"keying-material-exporter" ) && p[1 ] && p[2 ]) { -int ekm_length =positive_atoi (p[2 ], msglevel); -VERIFY_PERMISSION (OPT_P_GENERAL );if (strncmp (p[1 ],"EXPORTER" ,8 ))
@@ -9823,14 +9814,14 @@msg (msglevel,"Keying material exporter label must not be '" EXPORT_KEY_DATA_LABEL "'." ); } -if (ekm_length <16 || ekm_length >4095 ) + +if (!atoi_constrained (p[2 ], &options->keying_material_exporter_length, + p[0 ],16 ,4095 , msglevel)) { -msg (msglevel,"Invalid keying material exporter length" ); goto err; } options->keying_material_exporter_label = p[1 ]; - options->keying_material_exporter_length = ekm_length; }else if (streq (p[0 ],"allow-recursive-routing" ) && !p[1 ]) {
@@ -9865,15 +9856,14 @@ }else if (streq (p[0 ],"vlan-pvid" ) && p[1 ] && !p[2 ]) { +int vlan_pvid;VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INSTANCE ); - options->vlan_pvid =positive_atoi (p[1 ], msglevel); -if (options->vlan_pvid <OPENVPN_8021Q_MIN_VID - || options->vlan_pvid >OPENVPN_8021Q_MAX_VID ) +if (!atoi_constrained (p[1 ], &vlan_pvid, p[0 ], +OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID , msglevel)) { -msg (msglevel,"the parameter of --vlan-pvid parameters must be >= %u and <= %u" , -OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID ); goto err; } + options->vlan_pvid = (uint16_t )vlan_pvid; }else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
to look at the new patch set (#5).
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
options: Review use of positive_atoi vs atoi_constrained
Replace where it is useful.
While here also add a missing cast in atoi_constrained.
---
M src/openvpn/options.c
M src/openvpn/options_util.c
2 files changed, 22 insertions(+), 40 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/53/1153/5
src/openvpn/options.c +21 -31
@@ -7019,21 +7019,15 @@else if (streq (p[0 ],"tun-mtu-max" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); -int max_mtu =positive_atoi (p[1 ], msglevel); -if (max_mtu <68 || max_mtu >65536 ) - { -msg (msglevel,"--tun-mtu-max value '%s' is invalid" , p[1 ]); - } -else - { - options->ce.tun_mtu_max = max_mtu; - } +atoi_constrained (p[1 ], &options->ce.tun_mtu_max, p[0 ],TUN_MTU_MAX_MIN ,65536 , msglevel); }else if (streq (p[0 ],"tun-mtu-extra" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.tun_mtu_extra =positive_atoi (p[1 ], msglevel); - options->ce.tun_mtu_extra_defined = true; +if (atoi_constrained (p[1 ], &options->ce.tun_mtu_extra, p[0 ],0 ,65536 , msglevel)) + { + options->ce.tun_mtu_extra_defined = true; + } }else if (streq (p[0 ],"max-packet-size" ) && p[1 ] && !p[2 ]) {
@@ -7065,11 +7059,8 @@else if (streq (p[0 ],"fragment" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.fragment =positive_atoi (p[1 ], msglevel); - -if (options->ce.fragment <68 ) +if (!atoi_constrained (p[1 ], &options->ce.fragment, p[0 ],68 ,INT_MAX , msglevel)) { -msg (msglevel,"--fragment needs to be at least 68" ); goto err; }
@@ -7743,12 +7734,14 @@VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );if (p[1 ]) { -int mssfix =positive_atoi (p[1 ], msglevel); -/* can be 0, but otherwise it needs to be high enough so we can -* substract room for headers. */ -if (mssfix !=0 && (mssfix <TLS_CHANNEL_MTU_MIN || mssfix >UINT16_MAX )) +int mssfix; +if (!atoi_constrained (p[1 ], &mssfix, p[0 ],0 ,UINT16_MAX , msglevel)) { -msg (msglevel,"--mssfix value '%s' is invalid" , p[1 ]); + goto err; + } +if (mssfix !=0 && mssfix <TLS_CHANNEL_MTU_MIN ) + { +msg (msglevel,"mssfix needs to be >= %d, not %d" ,TLS_CHANNEL_MTU_MIN , mssfix); goto err; }
@@ -8001,7 +7994,7 @@else if (streq (p[0 ],"max-routes-per-client" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_INHERIT ); - options->max_routes_per_client =max_int (positive_atoi (p[1 ], msglevel),1 ); +atoi_constrained (p[1 ], &options->max_routes_per_client, p[0 ],1 ,INT_MAX , msglevel); }else if (streq (p[0 ],"client-cert-not-required" ) && !p[1 ]) {
@@ -9808,8 +9801,6 @@ }else if (streq (p[0 ],"keying-material-exporter" ) && p[1 ] && p[2 ]) { -int ekm_length =positive_atoi (p[2 ], msglevel); -VERIFY_PERMISSION (OPT_P_GENERAL );if (strncmp (p[1 ],"EXPORTER" ,8 ))
@@ -9823,14 +9814,14 @@msg (msglevel,"Keying material exporter label must not be '" EXPORT_KEY_DATA_LABEL "'." ); } -if (ekm_length <16 || ekm_length >4095 ) + +if (!atoi_constrained (p[2 ], &options->keying_material_exporter_length, + p[0 ],16 ,4095 , msglevel)) { -msg (msglevel,"Invalid keying material exporter length" ); goto err; } options->keying_material_exporter_label = p[1 ]; - options->keying_material_exporter_length = ekm_length; }else if (streq (p[0 ],"allow-recursive-routing" ) && !p[1 ]) {
@@ -9865,15 +9856,14 @@ }else if (streq (p[0 ],"vlan-pvid" ) && p[1 ] && !p[2 ]) { +int vlan_pvid;VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INSTANCE ); - options->vlan_pvid =positive_atoi (p[1 ], msglevel); -if (options->vlan_pvid <OPENVPN_8021Q_MIN_VID - || options->vlan_pvid >OPENVPN_8021Q_MAX_VID ) +if (!atoi_constrained (p[1 ], &vlan_pvid, p[0 ], +OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID , msglevel)) { -msg (msglevel,"the parameter of --vlan-pvid parameters must be >= %u and <= %u" , -OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID ); goto err; } + options->vlan_pvid = (uint16_t )vlan_pvid; }else {
src/openvpn/options_util.c +1 -9
@@ -162,11 +162,6 @@return (int )i; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -bool atoi_constrained (const char *str,int *value,const char *name,int min,int max,msglvl_t msglevel) {
@@ -194,13 +189,10 @@return false; } - *value = i; + *value = (int )i;return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" ,"dhcp-option" ,"dns" ,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email )
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
Patch Set 5: Code-Review+1
(1 comment)
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/1153/comment/b09f5803_fa7ecbdd :
PS5, Line 7997: atoi_constrained(p[1], &options->max_routes_per_client, p[0], 1, INT_MAX, msglevel);
This changes the program behavior. Before, it silently corrected max_routes_per_client to 1, now it exits with an error.
Probably a good change, but I'm not sure if you intended this commit to change behavior.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 26 Sep 2025 17:08:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: MaxF, flichtenheld, plaisthos.
Hello MaxF, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
to look at the new patch set (#6).
The following approvals got outdated and were removed:
Code-Review+1 by MaxF
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
options: Review use of positive_atoi vs atoi_constrained
Replace where it is useful.
While here also add a missing cast in atoi_constrained.
---
M src/openvpn/options.c
1 file changed, 21 insertions(+), 31 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/53/1153/6
src/openvpn/options.c +21 -31
@@ -6415,21 +6415,15 @@else if (streq (p[0 ],"tun-mtu-max" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); -int max_mtu =positive_atoi (p[1 ], msglevel); -if (max_mtu <68 || max_mtu >65536 ) - { -msg (msglevel,"--tun-mtu-max value '%s' is invalid" , p[1 ]); - } -else - { - options->ce.tun_mtu_max = max_mtu; - } +atoi_constrained (p[1 ], &options->ce.tun_mtu_max, p[0 ],TUN_MTU_MAX_MIN ,65536 , msglevel); }else if (streq (p[0 ],"tun-mtu-extra" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.tun_mtu_extra =positive_atoi (p[1 ], msglevel); - options->ce.tun_mtu_extra_defined = true; +if (atoi_constrained (p[1 ], &options->ce.tun_mtu_extra, p[0 ],0 ,65536 , msglevel)) + { + options->ce.tun_mtu_extra_defined = true; + } }else if (streq (p[0 ],"max-packet-size" ) && p[1 ] && !p[2 ]) {
@@ -6461,11 +6455,8 @@else if (streq (p[0 ],"fragment" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.fragment =positive_atoi (p[1 ], msglevel); - -if (options->ce.fragment <68 ) +if (!atoi_constrained (p[1 ], &options->ce.fragment, p[0 ],68 ,INT_MAX , msglevel)) { -msg (msglevel,"--fragment needs to be at least 68" ); goto err; }
@@ -7139,12 +7130,14 @@VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );if (p[1 ]) { -int mssfix =positive_atoi (p[1 ], msglevel); -/* can be 0, but otherwise it needs to be high enough so we can -* substract room for headers. */ -if (mssfix !=0 && (mssfix <TLS_CHANNEL_MTU_MIN || mssfix >UINT16_MAX )) +int mssfix; +if (!atoi_constrained (p[1 ], &mssfix, p[0 ],0 ,UINT16_MAX , msglevel)) { -msg (msglevel,"--mssfix value '%s' is invalid" , p[1 ]); + goto err; + } +if (mssfix !=0 && mssfix <TLS_CHANNEL_MTU_MIN ) + { +msg (msglevel,"mssfix needs to be >= %d, not %d" ,TLS_CHANNEL_MTU_MIN , mssfix); goto err; }
@@ -7397,7 +7390,7 @@else if (streq (p[0 ],"max-routes-per-client" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_INHERIT ); - options->max_routes_per_client =max_int (positive_atoi (p[1 ], msglevel),1 ); +atoi_constrained (p[1 ], &options->max_routes_per_client, p[0 ],1 ,INT_MAX , msglevel); }else if (streq (p[0 ],"client-cert-not-required" ) && !p[1 ]) {
@@ -9216,8 +9209,6 @@ }else if (streq (p[0 ],"keying-material-exporter" ) && p[1 ] && p[2 ]) { -int ekm_length =positive_atoi (p[2 ], msglevel); -VERIFY_PERMISSION (OPT_P_GENERAL );if (strncmp (p[1 ],"EXPORTER" ,8 ))
@@ -9231,14 +9222,14 @@msg (msglevel,"Keying material exporter label must not be '" EXPORT_KEY_DATA_LABEL "'." ); } -if (ekm_length <16 || ekm_length >4095 ) + +if (!atoi_constrained (p[2 ], &options->keying_material_exporter_length, + p[0 ],16 ,4095 , msglevel)) { -msg (msglevel,"Invalid keying material exporter length" ); goto err; } options->keying_material_exporter_label = p[1 ]; - options->keying_material_exporter_length = ekm_length; }else if (streq (p[0 ],"allow-recursive-routing" ) && !p[1 ]) {
@@ -9273,15 +9264,14 @@ }else if (streq (p[0 ],"vlan-pvid" ) && p[1 ] && !p[2 ]) { +int vlan_pvid;VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INSTANCE ); - options->vlan_pvid =positive_atoi (p[1 ], msglevel); -if (options->vlan_pvid <OPENVPN_8021Q_MIN_VID - || options->vlan_pvid >OPENVPN_8021Q_MAX_VID ) +if (!atoi_constrained (p[1 ], &vlan_pvid, p[0 ], +OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID , msglevel)) { -msg (msglevel,"the parameter of --vlan-pvid parameters must be >= %u and <= %u" , -OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID ); goto err; } + options->vlan_pvid = (uint16_t )vlan_pvid; }else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Attention is currently required from: MaxF, flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email )
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
Patch Set 6: Code-Review+2
(1 comment)
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/1153/comment/18e489ea_91e53016?usp=email :
PS5, Line 7997: atoi_constrained(p[1], &options->max_routes_per_client, p[0], 1, INT_MAX, msglevel);
Quoted 1 line
This changes the program behavior. […]
I think this is acceptable. There might be a config somewhere that has max-routes-per-client 0 in it, auto-upgraded to 1, but it does not make any sense whatsoever... "do not use options you do not understand".
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Thu, 09 Oct 2025 20:59:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: MaxF <[email protected]...>
PATCH v6 1/1 options: Review use of positive_atoi vs atoi_constrained
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Replace where it is useful.
While here also add a missing cast in atoi_constrained.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1153
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1153
This mail reflects revision 6 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/options.c +21 -31
@@ -6415,21 +6415,15 @@else if (streq (p[0 ],"tun-mtu-max" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); -int max_mtu =positive_atoi (p[1 ], msglevel); -if (max_mtu <68 || max_mtu >65536 ) - { -msg (msglevel,"--tun-mtu-max value '%s' is invalid" , p[1 ]); - } -else - { - options->ce.tun_mtu_max = max_mtu; - } +atoi_constrained (p[1 ], &options->ce.tun_mtu_max, p[0 ],TUN_MTU_MAX_MIN ,65536 , msglevel); }else if (streq (p[0 ],"tun-mtu-extra" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.tun_mtu_extra =positive_atoi (p[1 ], msglevel); - options->ce.tun_mtu_extra_defined = true; +if (atoi_constrained (p[1 ], &options->ce.tun_mtu_extra, p[0 ],0 ,65536 , msglevel)) + { + options->ce.tun_mtu_extra_defined = true; + } }else if (streq (p[0 ],"max-packet-size" ) && p[1 ] && !p[2 ]) {
@@ -6461,11 +6455,8 @@else if (streq (p[0 ],"fragment" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.fragment =positive_atoi (p[1 ], msglevel); - -if (options->ce.fragment <68 ) +if (!atoi_constrained (p[1 ], &options->ce.fragment, p[0 ],68 ,INT_MAX , msglevel)) { -msg (msglevel,"--fragment needs to be at least 68" ); goto err; }
@@ -7139,12 +7130,14 @@VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );if (p[1 ]) { -int mssfix =positive_atoi (p[1 ], msglevel); -/* can be 0, but otherwise it needs to be high enough so we can -* substract room for headers. */ -if (mssfix !=0 && (mssfix <TLS_CHANNEL_MTU_MIN || mssfix >UINT16_MAX )) +int mssfix; +if (!atoi_constrained (p[1 ], &mssfix, p[0 ],0 ,UINT16_MAX , msglevel)) { -msg (msglevel,"--mssfix value '%s' is invalid" , p[1 ]); + goto err; + } +if (mssfix !=0 && mssfix <TLS_CHANNEL_MTU_MIN ) + { +msg (msglevel,"mssfix needs to be >= %d, not %d" ,TLS_CHANNEL_MTU_MIN , mssfix); goto err; }
@@ -7397,7 +7390,7 @@else if (streq (p[0 ],"max-routes-per-client" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_INHERIT ); - options->max_routes_per_client =max_int (positive_atoi (p[1 ], msglevel),1 ); +atoi_constrained (p[1 ], &options->max_routes_per_client, p[0 ],1 ,INT_MAX , msglevel); }else if (streq (p[0 ],"client-cert-not-required" ) && !p[1 ]) {
@@ -9216,8 +9209,6 @@ }else if (streq (p[0 ],"keying-material-exporter" ) && p[1 ] && p[2 ]) { -int ekm_length =positive_atoi (p[2 ], msglevel); -VERIFY_PERMISSION (OPT_P_GENERAL );if (strncmp (p[1 ],"EXPORTER" ,8 ))
@@ -9231,14 +9222,14 @@msg (msglevel,"Keying material exporter label must not be '" EXPORT_KEY_DATA_LABEL "'." ); } -if (ekm_length <16 || ekm_length >4095 ) + +if (!atoi_constrained (p[2 ], &options->keying_material_exporter_length, + p[0 ],16 ,4095 , msglevel)) { -msg (msglevel,"Invalid keying material exporter length" ); goto err; } options->keying_material_exporter_label = p[1 ]; - options->keying_material_exporter_length = ekm_length; }else if (streq (p[0 ],"allow-recursive-routing" ) && !p[1 ]) {
@@ -9273,15 +9264,14 @@ }else if (streq (p[0 ],"vlan-pvid" ) && p[1 ] && !p[2 ]) { +int vlan_pvid;VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INSTANCE ); - options->vlan_pvid =positive_atoi (p[1 ], msglevel); -if (options->vlan_pvid <OPENVPN_8021Q_MIN_VID - || options->vlan_pvid >OPENVPN_8021Q_MAX_VID ) +if (!atoi_constrained (p[1 ], &vlan_pvid, p[0 ], +OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID , msglevel)) { -msg (msglevel,"the parameter of --vlan-pvid parameters must be >= %u and <= %u" , -OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID ); goto err; } + options->vlan_pvid = (uint16_t )vlan_pvid; }else {
[Openvpn-devel] [PATCH applied] Re: options: Review use of positive_atoi vs atoi_constrained
Changes makes sense. BB happy (though the t-client tests do not really excercise just these options). I have smoke tested --mssfix (because I had a test bed around from the checksum tests), works, gives nice error messages and does the job for acceptable values.
MaxF has done the initial review, and had doubts about changing the behaviour of "max-routes-per-client 0" - which used to be "silent upgrade to 1", and now "error".
Given that this is one of the very obscure openvpn options anyway, the chance that anyone is being hit by this is fairly small - and if it hits, their config was (silently) broken before. So, +2 from me, in it goes.
Your patch has been applied to the master branch.
commit 7579749fee05ee8a06dd6169396fb60f7558925a
Author: Frank Lichtenheld Date: Thu Oct 9 22:59:46 2025 +0200
options: Review use of positive_atoi vs atoi_constrained
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1153
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244617/
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#7) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
options: Review use of positive_atoi vs atoi_constrained
Replace where it is useful.
While here also add a missing cast in atoi_constrained.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1153
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244617/
---
M src/openvpn/options.c
1 file changed, 21 insertions(+), 31 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/53/1153/7
src/openvpn/options.c +21 -31
@@ -6421,21 +6421,15 @@else if (streq (p[0 ],"tun-mtu-max" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); -int max_mtu =positive_atoi (p[1 ], msglevel); -if (max_mtu <68 || max_mtu >65536 ) - { -msg (msglevel,"--tun-mtu-max value '%s' is invalid" , p[1 ]); - } -else - { - options->ce.tun_mtu_max = max_mtu; - } +atoi_constrained (p[1 ], &options->ce.tun_mtu_max, p[0 ],TUN_MTU_MAX_MIN ,65536 , msglevel); }else if (streq (p[0 ],"tun-mtu-extra" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.tun_mtu_extra =positive_atoi (p[1 ], msglevel); - options->ce.tun_mtu_extra_defined = true; +if (atoi_constrained (p[1 ], &options->ce.tun_mtu_extra, p[0 ],0 ,65536 , msglevel)) + { + options->ce.tun_mtu_extra_defined = true; + } }else if (streq (p[0 ],"max-packet-size" ) && p[1 ] && !p[2 ]) {
@@ -6467,11 +6461,8 @@else if (streq (p[0 ],"fragment" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.fragment =positive_atoi (p[1 ], msglevel); - -if (options->ce.fragment <68 ) +if (!atoi_constrained (p[1 ], &options->ce.fragment, p[0 ],68 ,INT_MAX , msglevel)) { -msg (msglevel,"--fragment needs to be at least 68" ); goto err; }
@@ -7145,12 +7136,14 @@VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );if (p[1 ]) { -int mssfix =positive_atoi (p[1 ], msglevel); -/* can be 0, but otherwise it needs to be high enough so we can -* substract room for headers. */ -if (mssfix !=0 && (mssfix <TLS_CHANNEL_MTU_MIN || mssfix >UINT16_MAX )) +int mssfix; +if (!atoi_constrained (p[1 ], &mssfix, p[0 ],0 ,UINT16_MAX , msglevel)) { -msg (msglevel,"--mssfix value '%s' is invalid" , p[1 ]); + goto err; + } +if (mssfix !=0 && mssfix <TLS_CHANNEL_MTU_MIN ) + { +msg (msglevel,"mssfix needs to be >= %d, not %d" ,TLS_CHANNEL_MTU_MIN , mssfix); goto err; }
@@ -7403,7 +7396,7 @@else if (streq (p[0 ],"max-routes-per-client" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_INHERIT ); - options->max_routes_per_client =max_int (positive_atoi (p[1 ], msglevel),1 ); +atoi_constrained (p[1 ], &options->max_routes_per_client, p[0 ],1 ,INT_MAX , msglevel); }else if (streq (p[0 ],"client-cert-not-required" ) && !p[1 ]) {
@@ -9222,8 +9215,6 @@ }else if (streq (p[0 ],"keying-material-exporter" ) && p[1 ] && p[2 ]) { -int ekm_length =positive_atoi (p[2 ], msglevel); -VERIFY_PERMISSION (OPT_P_GENERAL );if (strncmp (p[1 ],"EXPORTER" ,8 ))
@@ -9237,14 +9228,14 @@msg (msglevel,"Keying material exporter label must not be '" EXPORT_KEY_DATA_LABEL "'." ); } -if (ekm_length <16 || ekm_length >4095 ) + +if (!atoi_constrained (p[2 ], &options->keying_material_exporter_length, + p[0 ],16 ,4095 , msglevel)) { -msg (msglevel,"Invalid keying material exporter length" ); goto err; } options->keying_material_exporter_label = p[1 ]; - options->keying_material_exporter_length = ekm_length; }else if (streq (p[0 ],"allow-recursive-routing" ) && !p[1 ]) {
@@ -9279,15 +9270,14 @@ }else if (streq (p[0 ],"vlan-pvid" ) && p[1 ] && !p[2 ]) { +int vlan_pvid;VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INSTANCE ); - options->vlan_pvid =positive_atoi (p[1 ], msglevel); -if (options->vlan_pvid <OPENVPN_8021Q_MIN_VID - || options->vlan_pvid >OPENVPN_8021Q_MAX_VID ) +if (!atoi_constrained (p[1 ], &vlan_pvid, p[0 ], +OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID , msglevel)) { -msg (msglevel,"the parameter of --vlan-pvid parameters must be >= %u and <= %u" , -OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID ); goto err; } + options->vlan_pvid = (uint16_t )vlan_pvid; }else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email )
Change subject: options: Review use of positive_atoi vs atoi_constrained
......................................................................
options: Review use of positive_atoi vs atoi_constrained
Replace where it is useful.
While here also add a missing cast in atoi_constrained.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1153
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244617/
---
M src/openvpn/options.c
1 file changed, 21 insertions(+), 31 deletions(-)
src/openvpn/options.c +21 -31
@@ -6421,21 +6421,15 @@else if (streq (p[0 ],"tun-mtu-max" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); -int max_mtu =positive_atoi (p[1 ], msglevel); -if (max_mtu <68 || max_mtu >65536 ) - { -msg (msglevel,"--tun-mtu-max value '%s' is invalid" , p[1 ]); - } -else - { - options->ce.tun_mtu_max = max_mtu; - } +atoi_constrained (p[1 ], &options->ce.tun_mtu_max, p[0 ],TUN_MTU_MAX_MIN ,65536 , msglevel); }else if (streq (p[0 ],"tun-mtu-extra" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.tun_mtu_extra =positive_atoi (p[1 ], msglevel); - options->ce.tun_mtu_extra_defined = true; +if (atoi_constrained (p[1 ], &options->ce.tun_mtu_extra, p[0 ],0 ,65536 , msglevel)) + { + options->ce.tun_mtu_extra_defined = true; + } }else if (streq (p[0 ],"max-packet-size" ) && p[1 ] && !p[2 ]) {
@@ -6467,11 +6461,8 @@else if (streq (p[0 ],"fragment" ) && p[1 ] && !p[3 ]) {VERIFY_PERMISSION (OPT_P_MTU |OPT_P_CONNECTION ); - options->ce.fragment =positive_atoi (p[1 ], msglevel); - -if (options->ce.fragment <68 ) +if (!atoi_constrained (p[1 ], &options->ce.fragment, p[0 ],68 ,INT_MAX , msglevel)) { -msg (msglevel,"--fragment needs to be at least 68" ); goto err; }
@@ -7145,12 +7136,14 @@VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );if (p[1 ]) { -int mssfix =positive_atoi (p[1 ], msglevel); -/* can be 0, but otherwise it needs to be high enough so we can -* substract room for headers. */ -if (mssfix !=0 && (mssfix <TLS_CHANNEL_MTU_MIN || mssfix >UINT16_MAX )) +int mssfix; +if (!atoi_constrained (p[1 ], &mssfix, p[0 ],0 ,UINT16_MAX , msglevel)) { -msg (msglevel,"--mssfix value '%s' is invalid" , p[1 ]); + goto err; + } +if (mssfix !=0 && mssfix <TLS_CHANNEL_MTU_MIN ) + { +msg (msglevel,"mssfix needs to be >= %d, not %d" ,TLS_CHANNEL_MTU_MIN , mssfix); goto err; }
@@ -7403,7 +7396,7 @@else if (streq (p[0 ],"max-routes-per-client" ) && p[1 ] && !p[2 ]) {VERIFY_PERMISSION (OPT_P_INHERIT ); - options->max_routes_per_client =max_int (positive_atoi (p[1 ], msglevel),1 ); +atoi_constrained (p[1 ], &options->max_routes_per_client, p[0 ],1 ,INT_MAX , msglevel); }else if (streq (p[0 ],"client-cert-not-required" ) && !p[1 ]) {
@@ -9222,8 +9215,6 @@ }else if (streq (p[0 ],"keying-material-exporter" ) && p[1 ] && p[2 ]) { -int ekm_length =positive_atoi (p[2 ], msglevel); -VERIFY_PERMISSION (OPT_P_GENERAL );if (strncmp (p[1 ],"EXPORTER" ,8 ))
@@ -9237,14 +9228,14 @@msg (msglevel,"Keying material exporter label must not be '" EXPORT_KEY_DATA_LABEL "'." ); } -if (ekm_length <16 || ekm_length >4095 ) + +if (!atoi_constrained (p[2 ], &options->keying_material_exporter_length, + p[0 ],16 ,4095 , msglevel)) { -msg (msglevel,"Invalid keying material exporter length" ); goto err; } options->keying_material_exporter_label = p[1 ]; - options->keying_material_exporter_length = ekm_length; }else if (streq (p[0 ],"allow-recursive-routing" ) && !p[1 ]) {
@@ -9279,15 +9270,14 @@ }else if (streq (p[0 ],"vlan-pvid" ) && p[1 ] && !p[2 ]) { +int vlan_pvid;VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INSTANCE ); - options->vlan_pvid =positive_atoi (p[1 ], msglevel); -if (options->vlan_pvid <OPENVPN_8021Q_MIN_VID - || options->vlan_pvid >OPENVPN_8021Q_MAX_VID ) +if (!atoi_constrained (p[1 ], &vlan_pvid, p[0 ], +OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID , msglevel)) { -msg (msglevel,"the parameter of --vlan-pvid parameters must be >= %u and <= %u" , -OPENVPN_8021Q_MIN_VID ,OPENVPN_8021Q_MAX_VID ); goto err; } + options->vlan_pvid = (uint16_t )vlan_pvid; }else {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1153?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Gerrit-Change-Number: 1153
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>